<template>
	<view>
		<view class="bcg">
			<view class="title" @click="gouserinfo">
				<view class="tit_l">
					<image v-if="userInfo.headImg" :src="userInfo.headImg" mode=""></image>
					<image v-else src="../../static/1.jpg" mode=""></image>
				</view>
				<view class="tit_r">
					<view class="ts1">{{userInfo.nickName}}</view>
					<view class="ts2">{{userInfo.phone}}</view>
				</view>
			</view>
			<view class="content">
				<view class="c_item" @click="goPage(1)">
					<view class="c_item_flex">
						<image src="../../static/c.png" mode=""></image>
						<view class="text">车辆管理</view>
					</view>
					<uni-icons type="right" size="22" color="#979797"></uni-icons>
				</view>
				<view class="c_item" @click="goPage(2)">
					<view class="c_item_flex">
						<image src="../../static/d.png" mode=""></image>
						<view class="text">订单管理</view>
					</view>
					<uni-icons type="right" size="22" color="#979797"></uni-icons>
				</view>
			</view>
			<view class="btn" @click="handleLoginOut">
				退出登录
			</view>
		</view>

	</view>
</template>

<script>
	import {
		logout,getUserinfo
	} from '../../common/http.api.js'
	export default {
		data() {
			return {
				statusBarHeight: uni.getStorageSync('heights'),
				userInfo:{}
			};
		},
		onShow() {
			getUserinfo().then(res=>{
				this.userInfo = res.data
			})
		},
		methods:{
			handleLoginOut(){
					logout().then(res=>{
						if(res.code == 200){
							uni.reLaunch({
								url:'/pages/login/login'
							})
							uni.removeStorageSync('token')
						}
					})
			},
			goPage(i){
				console.log('1111111111');
				if(i == 1){
					uni.navigateTo({
						url:'/pages/my/carList'
					})
				}else{
					uni.navigateTo({
						url:'/pages/my/orderList'
					})
				}
				
			},
			gouserinfo(){
				uni.navigateTo({
					url:'/pages/my/userinfo'
				})
			}
		}
	}
</script>

<style lang="scss">
	page {
		background-color: #F6F6F6;
	}
	.bcg {
		width: 750rpx;
		height: 180rpx;
		background: linear-gradient(#D6DDF3 0%, #F6F6F6 100%);
	}

	.title {
		width: 702rpx;
		margin: 0rpx auto 40rpx;
		display: flex;
		align-items: center;
		padding-top: 60rpx;
		.tit_l {
			width: 110rpx;
			height: 110rpx;
			margin-right: 20rpx;

			image {
				width: 110rpx;
				height: 110rpx;
				border-radius: 50%;
			}
		}

		.tit_r {
			line-height: 40rpx;

			.ts1 {
				font-weight: bold;
				font-size: 32rpx;
				color: #0F0F0F;
			}

			.ts2 {
				font-weight: 400;
				font-size: 24rpx;
				color: #797979;
			}
		}
	}
	.content{
		.c_item{
			display: flex;
			background-color: #ffffff;
			width: 702rpx;
			height: 98rpx;
			align-items: center;
			margin: 20rpx auto;
			border-radius: 10rpx;
			padding: 24rpx;
			box-sizing: border-box;
			justify-content: space-between;
			.c_item_flex{
				display: flex;
				align-items: center;
				image{
					width: 40rpx;
					height: 38rpx;
					margin-right: 20rpx;
				}
				.text{
					font-weight: 400;
					font-size: 28rpx;
					color: #070707;
				}
			}
		}
	}
	.btn{
		width: 702rpx;
		height: 98rpx;
		background-color: #ffffff;
		text-align: center;
		line-height: 98rpx;
		position: fixed;
		bottom: 240rpx;
		transform: translateX(-50%);
		left:50%;
		font-weight: 400;
		font-size: 28rpx;
		color: #070707;
	}
</style>